import sqlite3
from multiprocessing import Pool
import json
import baostock as bs
import pandas as pd
from concurrent.futures import ThreadPoolExecutor
import time

def connectDb(dbName='stock-data.db'):
    conn = sqlite3.connect(dbName)
    c = conn.cursor()
    return conn

def closeDb(conn):
    conn.commit()# 提交对数据库的改动
    conn.close() # 关闭数据库

def getDbStockData(conn, stockCode='sh.000001'):
    df = pd.read_sql_query("select * from  \"" + stockCode + "\"", conn)
    return df

if __name__ == "__main__":
    dbName = "/home/colby/sd_480/01.liang_hua_tou_zi/01.python_gu_piao_liang_hua/00.huo_qu_gu_piao_shu_ju/stock-data.db"
    conn = connectDb(dbName)
    df = getDbStockData(conn, stockCode='sh.000002')
    print(df)

    